import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
//import java.awt.List;
import java.util.List;


public class RFIFOMulticast {
	
	private List<Object> recipients = new ArrayList<Object>();
	
	
	
	
	public RFIFOMulticast(List<Object> recipients){
		this.recipients = recipients;
	}
	
	protected void PrintCurrentRecipients(){
		
		System.out.println("Current Recipient:");
		for(int i=0; i<recipients.size();i++){
			System.out.println(recipients.get(i));
		}
	}
	
	private int CalculateCRC(){
		return 0;
	}
	private boolean Corrupted(){
		return false;
	}
	
	
	/* Once the handler interface is ready this method will be void
	 * And the result will be in the result_handler or fault_handler */
	public String send(Map<String,String> message){
		
		String total = "";
		
		for(String key: message.keySet() ){
			System.out.println("key is: "+key+ " and value is: "+message.get(key));
			total = total.concat(key.concat(message.get(key)));
		}
		return total;
	}
}


class Test{
	public static void main(String args[]){
		
		List<Object> aList = new ArrayList<Object>();
		/*U can also specify to add at a certain index*/
		aList.add("Host0");
		aList.add("Host1");
		aList.add("Host2");
		
		Map<String,String> message = new HashMap<String,String>();
		message.put("request_type", "SUSPECT");
		message.put("host_address", "alpha4");
		
		RFIFOMulticast rfms = new RFIFOMulticast(aList);
		/* This method is only for me :)*/
		rfms.PrintCurrentRecipients();
		String reply = rfms.send(message);
		System.out.println(reply);
		
		
	}
}
